package spring.j2024_11_17_2.wall.service;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import spring.j2024_11_17_2.wall.dao.MessageDao;
import spring.j2024_11_17_2.wall.model.Message;

import java.util.List;

@Component
public class MessageService {
      @Autowired
      private MessageDao messageDao ;
     public boolean isPut(Message message){
         if(!StringUtils.hasLength(message.getFrom()) ||
                 !StringUtils.hasLength(message.getTo())||
                 !StringUtils.hasLength(message.getSay())){
             return false ;
         }
         messageDao.put(message);
         return true ;
     }
     public List<Message> get(){
         return messageDao.getList();
     }
}
